package com.learn.util;

import com.google.common.collect.Sets;
import org.apache.commons.lang3.StringUtils;

import java.util.HashSet;
import java.util.Set;

/**
 * @author Created by chenxin34 on 2019/9/25 下午8:49.
 */
public class GreyUtils {
    public static void main(String[] args) {
        String origin = "2013364";
        String grey = "2699";

        Set<String> originSet = parseCommaSeperatedStringSet(origin);

        Set<String> greySet = parseCommaSeperatedStringSet(grey);

        for (String s : greySet) {
            if (originSet.contains(s)) {
                System.out.println("XXX");
            }
        }
        System.out.println("end");

        String demand = "2013364";
        String crowdV1 = "2013364";

        String crowdV2 = "2013364";

        System.out.println(demand.equals(crowdV1));
        System.out.println(crowdV1.equals(crowdV2));

        String origin2 = "2013364";
        System.out.println(origin.equals(origin2));
    }


    private static Set<String> parseCommaSeperatedStringSet(String str) {
        Set<String> resSet;
        if (StringUtils.isBlank(str)) {
            return new HashSet<>();
        }
        String[] configStr = str.split(",");
        resSet = Sets.newHashSet(configStr);
        return resSet;
    }
}
